<!DOCTYPE html>
<html>
    
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
        <link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" />
        <title>query.attribute</title>
        <script>
            window.$$path = location.protocol + "//" + location.host;
            document.write('<script src="' + $$path + '/mass_merge.js"><\/script>');
            document.write('<script src="' + $$path + '/doc/scripts/common.js"><\/script>');
        </script>
        <style type="text/css">
            ul{
                list-style-image: url(../public/images/li.gif)
            }
            .list {
                color:#FF6363;
                font-weight:bolder;
            }
            table.clicktable {
                border-collapse:collapse;
                border:#8a6100 1px solid;
            }
            table.clicktable th{
                border:#8a6100 2px solid;
                border-color:  #ffe3a4 #ffe3a4 #8a6100 #8a6100;
                color: #ffff00;
                background:#e19d00;
            }
            table.clicktable td{
                border:#8a6100 1px   inset;
                background:#EEE8AA;
                color:#000;
            }
            table.clicktable tr.even td{
                background:#FF7F50;
                color:#8B4513;
            }
        </style>
        <script type="text/javascript">
            $(function(){
                $("body").delegate(".clicktable tbody td","click",function(){
                    var input =  $("input[type=checkbox]:first")
                    if(input.length){
                        input[0].indeterminate = true;
                    }
                    var code = $.String.unescapeHTML( this.innerHTML )
                    $.parseJS( code );
                });
            })
        </script>
    </head>
    
    <body>
        <article>
            <style>
                #scrollTable {
                    width:701px;
                    border: 1px solid #EB8;/*table没有外围的border，只有内部的td或th有border*/
                    background: #FF8C00;
                }
            
                #scrollTable table {
                    border-collapse:collapse; /*统一设置两个table为细线表格*/
                }
                /*表头 div的第一个子元素**/
                #scrollTable table.thead{
                    width:100%;
                }
                /*表头*/
                #scrollTable table.thead th{
                    border: 1px solid #EB8;
                    border-right:#C96;
                    color:#fff;
                    background: #FF8C00;/*亮桔黄色*/
                }
                /*能带滚动条的表身*/
                /*div的第二个子元素*/
                #scrollTable div{
                    width:100%;
                    height:200px;
                    overflow:auto;/*必需*/
                    scrollbar-face-color:#EB8;/*那三个小矩形的背景色*/
                    scrollbar-base-color:#ece9d8;/*那三个小矩形的前景色*/
                    scrollbar-arrow-color:#FF8C00;/*上下按钮里三角箭头的颜色*/
                    scrollbar-track-color:#ece9d8;/*滚动条的那个活动块所在的矩形的背景色*/
                    scrollbar-highlight-color:#ece9d8;/*那三个小矩形左上padding的颜色*/
                    scrollbar-shadow-color:#ece9d8;/*那三个小矩形右下padding的颜色*/
                    scrollbar-3dlight-color: #EB8;/*那三个小矩形左上border的颜色*/
                    scrollbar-darkshadow-Color:#EB8;/*那三个小矩形右下border的颜色*/
                }
                /*能带滚动条的表身的正体*/
                #scrollTable table.tbody{
                    width:100%;
                    border: 1px solid #C96;
                    border-right:#B74;
                    color:#666666;
                    background: #ECE9D8;
            
                }
                /*能带滚动条的表身的格子*/
                #scrollTable table.tbody td{
                    border:1px solid #C96;
                }
            </style>
            <p>属性选择器。详见
                <a href="http://www.cnblogs.com/rubylouvre/archive/2009/10/27/1590102.html">我的博客</a>或下表:</p>
            <div id="scrollTable">
                <table class="thead">
                    <col width="170px"></col>
                    <col width="170px"></col>
                    <col width="170px"></col>
                    <col></col>
                    <tbody>
                        <tr>
                            <th>名称</th>
                            <th>语法</th>
                            <th>说明</th>
                            <th>例子</th>
                        </tr>
                    </tbody>
                </table>
                <div>
                    <table class="tbody">
                        <col width="170px"></col>
                        <col width="170px"></col>
                        <col width="170px"></col>
                        <col></col>
                        <tbody>
                            <tr>
                                <td>Simple attribute Selector</td>
                                <td>[attr]</td>
                                <td>选择具有此属性的元素</td>
                                <td>blockquote[title] {
                                    <br/>color: red }</td>
                            </tr>
                            <tr>
                                <td>attribute Value Selector</td>
                                <td>[attr="value"]</td>
                                <td>选出属性值精确等于给出值的元素</td>
                                <td>h2[align="left"] {
                                    <br/>cursor: hand }</td>
                            </tr>
                            <tr>
                                <td>"Begins-with" attribute Value Selector</td>
                                <td>[attr^="value"]</td>
                                <td>选出属性值以给出值开头的元素</td>
                                <td>h2[align^="right"] {
                                    <br/>cursor: hand }</td>
                            </tr>
                            <tr>
                                <td>"Ends-with" attribute Value Selector</td>
                                <td>[attr$="value"]</td>
                                <td>选出属性值以给出值结尾的元素</td>
                                <td>div[class$="vml"]{
                                    <br/>cursor: hand}</td>
                            </tr>
                            <tr>
                                <td>Substring-match attribute Value Selector</td>
                                <td>[attr*="value"]</td>
                                <td>选出属性值包含给出值的元素</td>
                                <td>div[class*="grid"]{
                                    <br/>float:left}</td>
                            </tr>
                            <tr>
                                <td>One-Of-Many Attribute Value Selector</td>
                                <td>[attr~="value"]</td>
                                <td>原元素的属性值为多个单词，给出值为其中一个。</td>
                                <td>li[class~="last"]{
                                    <br/>padding-left:2em}</td>
                            </tr>
                            <tr>
                                <td>Hyphen Attribute Value Selector</td>
                                <td>[attr|="value"]</td>
                                <td>原元素的属性值等于给出值，或者以给出值加“-”开头</td>
                                <td>span[lang|="en"]{
                                    <br/>color:green}</td>
                            </tr>
                            <tr>
                                <td>反选属性值选择器</td>
                                <td>[attr!="value"]</td>
                                <td>非标准，原元素只有一个类名，它的值不等于给出值</td>
                                <td>span[class!="red"]{
                                    <br/>color:green}</td>
                            </tr>
                        </tbody>
                    </table>
                </div>
            </div>
            <fieldset>
                <legend>例子</legend>
                <table class="clicktable" cellspacing="0" width="700" rules="cols">
                    <thead>
                        <tr>
                            <th>请点击下面表格</th>
                        </tr>
                    </thead>
                    <tbody>
                        <tr>
                            <td>$("[style]").css("background-color","aqua");</td>
                        </tr>
                        <tr>
                            <td>$("ul [class='second']").css("background-color","aquamarine");</td>
                        </tr>
                        <tr>
                            <td>$("ul [class^='thi']").css("background-color","aquamarine");</td>
                        </tr>
                        <tr>
                            <td>$("ul [class$='th']").css("background-color","blueviolet");</td>
                        </tr>
                        <tr>
                            <td>$("ul [class*='fourth']").css("background-color","burlywood");</td>
                        </tr>
                        <tr>
                            <td>$("ul [class~='second']").css("background-color","chartreuse");</td>
                        </tr>
                        <tr>
                            <td>$("ul [lang|='zh']").css("background-color","fuchsia");</td>
                        </tr>
                        <tr>
                            <td>$("ul [class!='second']").css("background-color","red");</td>
                        </tr>
                        <tr>
                            <td>$("ul [class='second'][title='second']").css("background-color","gold");</td>
                        </tr>
                    </tbody>
                </table>
                <pre class="brush:xml;gutter:false;toolbar:false">

    <ul>
        <li class="first" style="font-weight:bolder">First class.</li>
        <li class="second" title="second">Second class.</li>
        <li class="third">Third class.</li>
        <li class="first second">First and second class.</li>
        <li class="first third fourth">First , third and fourth class.</li>
        <li class="second third">Second and third class.</li>
        <li class="first fourth fifth " lang="zh-cn">First, fourth and fifth class.</li>
    </ul>
    
</pre>
                <ul>
                    <li class="first" style="font-weight:bolder">First class.</li>
                    <li class="second" title="second">Second class.</li>
                    <li class="third">Third class.</li>
                    <li class="first second">First and second class.</li>
                    <li class="first third fourth">First , third and fourth class.</li>
                    <li class="second third">Second and third class.</li>
                    <li class="first fourth fifth " lang="zh-cn">First, fourth and fifth class.</li>
                </ul>
            </fieldset>
        </article>
    </body>

</html>